package 异常2;

public class ExceptionDemo02 {
    public static void main(String[] args) {
        System.out.println("开始");

    }
    public static void method(){
        try {
            int[] arr={1,2,3};
            System.out.println(arr[3]);
            System.out.println("这里能访问到吗");
        } catch (ArrayIndexOutOfBoundsException e) {

            /*public String getMessage()返回此throwable的详细消息字符串*/
            System.out.println(e.getMessage());
            /*public String toString()返回此可以抛出的简短描述*/
//            System.out.println(e.toString());
            e.printStackTrace();
        }
    }
}